package com.epfresh.supplier.entity;

import com.epfresh.api.utils.DateUtil;

import java.util.List;

/**
 * Created by zhaozhenqiang on 2018/4/16.
 */

public class OfferListEntity {

    /**
     * content : [{"id":14,"accountTag":"常客","accountName":"李金娣","productList":[{"imageUrl":"http://imgtest.epfresh.com/2017%2F6%2F23%2Fa605708a419e4ab68194612c8832e91c.jpg-PRODUCTTHUMBNAIL","id":29,"title":"本地青椒辣椒(一级)","count":6,"merMsg":"JJ健健康康咯菌腈","unitPrice":4,"pack":"1公斤/袋","disabled":true,"chargeUnit":"公斤"},{"imageUrl":"http://imgtest.epfresh.com/2017%2F6%2F23%2Fd8e07faab01e40dfb0c43e116a7518f1.jpg-PRODUCTTHUMBNAIL","id":30,"title":"湖北带根金针菇金针菇(如意情)(一级)","count":5,"merMsg":"随便","unitPrice":20,"pack":"2.5公斤/袋","disabled":true,"chargeUnit":"袋"},{"imageUrl":"http://imgtest.epfresh.com/2017%2F6%2F23%2F68a7214bb99d49999f6d95114671a983.jpg-PRODUCTTHUMBNAIL","id":31,"title":"山东蒜苔蒜薹","count":3,"merMsg":"","unitPrice":6,"pack":"1公斤/袋","disabled":true,"chargeUnit":"公斤"}],"accountSubjectName":"菜市场"}]
     * createTime : 2018-04-16 10:40:28.596
     * expiredMin : 30
     * last : true
     * totalElements : 1
     * number : 0
     * supplyGiveupReason : [{"id":"今日缺货"},{"id":2,"tile":"放弃报价"},{"id":9,"tile":"批发商放弃报价"}]
     * size : 10
     */

    private String startTime;
    private List<String> expiredMin;
    private boolean last;
    private int totalElements;
    private int number;
    private int size;
    private List<ContentBean> content;
    private List<SupplyGiveupReasonBean> supplyGiveupReason;

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public List<String> getExpiredMin() {
        return expiredMin;
    }


    public void setExpiredMin(List expiredMin) {
        this.expiredMin = expiredMin;
    }

    public boolean isLast() {
        return last;
    }

    public void setLast(boolean last) {
        this.last = last;
    }

    public int getTotalElements() {
        return totalElements;
    }

    public void setTotalElements(int totalElements) {
        this.totalElements = totalElements;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public List<ContentBean> getContent() {
        return content;
    }

    public void setContent(List<ContentBean> content) {
        this.content = content;
    }

    public List<SupplyGiveupReasonBean> getSupplyGiveupReason() {
        return supplyGiveupReason;
    }

    public void setSupplyGiveupReason(List<SupplyGiveupReasonBean> supplyGiveupReason) {
        this.supplyGiveupReason = supplyGiveupReason;
    }

    public static class ContentBean {
        public boolean isProductEffective() {
            return productEffective;
        }

        public void setProductEffective(boolean productEffective) {
            this.productEffective = productEffective;
        }

        /**
         * id : 14
         * accountTag : 常客
         * accountName : 李金娣
         * productList : [{"imageUrl":"http://imgtest.epfresh.com/2017%2F6%2F23%2Fa605708a419e4ab68194612c8832e91c.jpg-PRODUCTTHUMBNAIL","id":29,"title":"本地青椒辣椒(一级)","count":6,"merMsg":"JJ健健康康咯菌腈","unitPrice":4,"pack":"1公斤/袋","disabled":true,"chargeUnit":"公斤"},{"imageUrl":"http://imgtest.epfresh.com/2017%2F6%2F23%2Fd8e07faab01e40dfb0c43e116a7518f1.jpg-PRODUCTTHUMBNAIL","id":30,"title":"湖北带根金针菇金针菇(如意情)(一级)","count":5,"merMsg":"随便","unitPrice":20,"pack":"2.5公斤/袋","disabled":true,"chargeUnit":"袋"},{"imageUrl":"http://imgtest.epfresh.com/2017%2F6%2F23%2F68a7214bb99d49999f6d95114671a983.jpg-PRODUCTTHUMBNAIL","id":31,"title":"山东蒜苔蒜薹","count":3,"merMsg":"","unitPrice":6,"pack":"1公斤/袋","disabled":true,"chargeUnit":"公斤"}]
         * accountSubjectName : 菜市场
         * disabled
         */


        private boolean productEffective;
        private OfferListEntity father;
        private String id;
        private String accountTag;
        private String accountName;
        private String accountSubjectName;
        private List<ProductListBean> productList;
        private int offerStatus;

        private String allOrderCnt;
        private String storeOrderCnt;
        private String successCnt;
        private String offerReplySuccessCnt;
        private String lastPlaceOrderTime;

        private String remark;

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public String getLastPlaceOrderTime() {
            return lastPlaceOrderTime;
        }

        public void setLastPlaceOrderTime(String lastPlaceOrderTime) {
            this.lastPlaceOrderTime = lastPlaceOrderTime;
        }

        public String getAllOrderCnt() {
            return allOrderCnt;
        }

        public void setAllOrderCnt(String allOrderCnt) {
            this.allOrderCnt = allOrderCnt;
        }

        public String getStoreOrderCnt() {
            return storeOrderCnt;
        }

        public void setStoreOrderCnt(String storeOrderCnt) {
            this.storeOrderCnt = storeOrderCnt;
        }

        public String getSuccessCnt() {
            return successCnt;
        }

        public void setSuccessCnt(String successCnt) {
            this.successCnt = successCnt;
        }

        public String getOfferReplySuccessCnt() {
            return offerReplySuccessCnt;
        }

        public void setOfferReplySuccessCnt(String offerReplySuccessCnt) {
            this.offerReplySuccessCnt = offerReplySuccessCnt;
        }

        private String expiredMinSelect;

        public String getExpiredMinSelect() {
            if(expiredMinSelect == null)
                return getFather().getExpiredMin().get(0);
            else
                return expiredMinSelect;
        }


        public void setExpiredMinSelect(String expiredMinSelect) {
            this.expiredMinSelect = expiredMinSelect;
        }



        public OfferListEntity getFather() {
            return father;
        }

        public void setFather(OfferListEntity father) {
            this.father = father;
        }



/*


        public String getCreateTime() {
            return createTime;
        }

        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }
*/

        public int getOfferStatus() {
            return offerStatus;
        }

        public void setOfferStatus(int offerStatus) {
            this.offerStatus = offerStatus;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getAccountTag() {
            return accountTag;
        }

        public void setAccountTag(String accountTag) {
            this.accountTag = accountTag;
        }

        public String getAccountName() {
            return accountName;
        }

        public void setAccountName(String accountName) {
            this.accountName = accountName;
        }

        public String getAccountSubjectName() {
            return accountSubjectName;
        }

        public void setAccountSubjectName(String accountSubjectName) {
            this.accountSubjectName = accountSubjectName;
        }

        public List<ProductListBean> getProductList() {
            return productList;
        }

        public void setProductList(List<ProductListBean> productList) {
            this.productList = productList;
        }

        public static class ProductListBean {
            /**
             * imageUrl : http://imgtest.epfresh.com/2017%2F6%2F23%2Fa605708a419e4ab68194612c8832e91c.jpg-PRODUCTTHUMBNAIL
             * id : 29
             * title : 本地青椒辣椒(一级)
             * count : 6
             * merMsg : JJ健健康康咯菌腈
             * unitPrice : 4
             * pack : 1公斤/袋
             * disabled : true
             * chargeUnit : 公斤
             *
             * productOfferId
             */

            //private String productOfferDetailsId;

            private int productStatus;

            private int status;

            public int getStatus() {
                return status;
            }

            public void setStatus(int status) {
                this.status = status;
            }

            public int getProductStatus() {
                return productStatus;
            }

            public void setProductStatus(int productStatus) {
                this.productStatus = productStatus;
            }

            private ContentBean father;
            private boolean isHeader;
            private boolean isFoot;
            private int offerStatus;

            private String priceUnit;
            private String priceTitle;

            private String createTime;
            private String remark;
            private String endTime;
            public String getCreateTime() {
                return createTime;
            }

            public void setCreateTime(String createTime) {
                this.createTime = createTime;
            }

            public String getEndTime() {
                return endTime;
            }

            public void setEndTime(String endTime) {
                this.endTime = endTime;
            }

            public String getReminderTime(){
                if (endTime != null){
                    long tEnd = DateUtil.formatTimeLong(endTime);
                    long tLocale = getNowTime();
                    long nowRemindTime;

                    if (tLocale <= tEnd){//活动进行中
                        nowRemindTime = (tEnd - tLocale)/1000;
                        String timeFlag;
                        if (nowRemindTime > 60) {
                            long hour = nowRemindTime/3600;
                            long minus = nowRemindTime%3600 / 60;
                            long sec = nowRemindTime % 60;
                            if (hour < 10) {
                                timeFlag = "0" + hour;


                                if (minus < 10) {
                                    timeFlag += ":0" + minus;
                                } else {
                                    timeFlag += ":" + minus;
                                }
                                if (sec < 10) {
                                    timeFlag += ":0" + sec;
                                } else {
                                    timeFlag += ":" + sec;
                                }

                            } else {
                                timeFlag = "" + hour;

                                if (minus < 10) {
                                    timeFlag += ":0" + minus;
                                } else {
                                    timeFlag += ":" + minus;
                                }
                                if (sec < 10) {
                                    timeFlag += ":0" + sec;
                                } else {
                                    timeFlag += ":" + sec;
                                }

                            }
                            return timeFlag;


                        } else if (nowRemindTime > 0) {
                            if (nowRemindTime < 10) {
                                timeFlag = "00:00:0" + nowRemindTime;
                            } else {
                                timeFlag = "00:00:" + nowRemindTime;
                            }
                            return timeFlag;
                        }



                    }else {//活动结束了
                        return "";
                    }
                }

                return "";
            }

            public long getNowTime() {
                return System.currentTimeMillis();
            }


            public String getRemark() {
                return remark;
            }

            public void setRemark(String remark) {
                this.remark = remark;
            }




            public String getPriceUnit() {
                return priceUnit;
            }

            public void setPriceUnit(String priceUnit) {
                this.priceUnit = priceUnit;
            }

            public String getPriceTitle() {
                return priceTitle;
            }

            public void setPriceTitle(String priceTitle) {
                this.priceTitle = priceTitle;
            }

            private Double priceNow;

            public Double getPriceNow() {
                if(priceNow!=null&&priceNow!=0)
                    return priceNow;
                else {
                    return unitPrice;
                }
            }

            public void setPriceNow(Double priceNow) {
                this.priceNow = priceNow;
            }

            public int getOfferStatus() {
                return offerStatus;
            }

            public void setOfferStatus(int offerStatus) {
                this.offerStatus = offerStatus;
            }

            public boolean isHeader() {
                return isHeader;
            }

            public void setHeader(boolean header) {
                isHeader = header;
            }

            public boolean isFoot() {
                return isFoot;
            }

            public void setFoot(boolean foot) {
                isFoot = foot;
            }

            public ContentBean getFather() {
                return father;
            }

            public void setFather(ContentBean father) {
                this.father = father;
            }

            private String imageUrl;
            private String id;
            private String productOfferDetailsId;
            private String title;
            private String count;
            private String merMsg;
            private double unitPrice;
            private String pack;
            private boolean disabled;
            private String chargeUnit;
            private String disabledMsg;

            public String getProductOfferDetailsId() {
                return productOfferDetailsId;
            }

            public void setProductOfferDetailsId(String productOfferDetailsId) {
                this.productOfferDetailsId = productOfferDetailsId;
            }

            public String getDisabledMsg() {
                return disabledMsg;
            }

            public void setDisabledMsg(String disabledMsg) {
                this.disabledMsg = disabledMsg;
            }

            public String getImageUrl() {
                return imageUrl;
            }

            public void setImageUrl(String imageUrl) {
                this.imageUrl = imageUrl;
            }

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public String getTitle() {
                return title;
            }

            public void setTitle(String title) {
                this.title = title;
            }

            public String getCount() {
                return count;
            }

            public void setCount(String count) {
                this.count = count;
            }

            public String getMerMsg() {
                return merMsg;
            }

            public void setMerMsg(String merMsg) {
                this.merMsg = merMsg;
            }

            public double getUnitPrice() {
                return unitPrice;
            }

            public void setUnitPrice(double unitPrice) {
                this.unitPrice = unitPrice;
            }

            public String getPack() {
                return pack;
            }

            public void setPack(String pack) {
                this.pack = pack;
            }

            public boolean isDisabled() {
                return disabled;
            }

            public void setDisabled(boolean disabled) {
                this.disabled = disabled;
            }

            public String getChargeUnit() {
                return chargeUnit;
            }

            public void setChargeUnit(String chargeUnit) {
                this.chargeUnit = chargeUnit;
            }
        }
    }

    public static class SupplyGiveupReasonBean {
        /**
         * id : 今日缺货
         * tile : 放弃报价
         */

        private String id;
        private String reason;
        private boolean select;

        public boolean isSelect() {
            return select;
        }

        public void setSelect(boolean select) {
            this.select = select;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getReason() {
            return reason;
        }

        public void setReason(String reason) {
            this.reason = reason;
        }
    }
}
